package com.totoro.mapstruct.mapstruct_mapping_from_map;

import com.totoro.mapstruct.mapstruct_mapping_from_map.util.MappingUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * Created by Niki on 2018/8/8 9:41
 */
@Mapper(uses = MappingUtil.class)
public interface SourceTargetMapper {
    SourceTargetMapper instance = Mappers.getMapper(SourceTargetMapper.class);

    @Mappings({
            @Mapping(source = "map", target = "ip", qualifiedBy = MappingUtil.Ip.class),
            @Mapping(source = "map", target = "server", qualifiedBy = MappingUtil.Server.class)
    })
    Target toTarget(Source source);
}
